<script type="text/javascript">
$(function(){
	$('#datagrid').datagrid({  
	    url:'myArticleData',
	    columns:[[  
	        {field:'id',title:'ID',width:50,align:'center',align:'center'},  
	        {field:'title',title:'标题',width:300,align:'center'}, 	
	        {field:'create_time',title:'创建时间',width:150,align:'center'}, 	
	        {field:'action',title:'操作',width:150,align:'center',
	        	formatter:function(value,row,index){
	        		var a = "<a href=''>查看详情</a> ";
	        		var b = "<a href='javascript:delArticle("+row.id+")'>删除</a> ";
	        		return a +""+b;
	        	}
	        }
	    ]],
	    pagination : true,
		rownumbers : true,
		pageSize : 10,
		singleSelect : true
	});  
});	

 function delArticle(id){
	 
			$.messager.confirm('删除','你确定要删除这篇文章吗?',function(r){
			    if (r){  
					$.getJSON('delArticle',{'id':id},function(data){
						if(data.code=="00"){
							$('#datagrid').datagrid('reload');
							$.messager.alert('消息',data.msg);
							
						}else{
							$.messager.alert('警告',data.msg);
						}
					});
			    }  
			});
		
 }
</script>

<table id="datagrid"></table>